package DAOtest;

import java.io.IOException;
import java.util.List;

import org.junit.Test;

import Crawler_data.Crawler_data;
import DAO.L_likeDAO;
import DAO.SongDOA;
import DAO.UserDAO;
import DBUntil.DbHelper;
import Download.CancelDelete;
import Download.LoadUser;
import each_class.SongClass;
import each_class.User;

public class I_LikeDAOTest {

	DbHelper db = new DbHelper();

	@Test
	public void test01() {
		List<SongClass> ls = Crawler_data.grabble("海底", 0);

		L_likeDAO like = new L_likeDAO();
		for (SongClass s : ls) {

			try {
				SongDOA.addSong(s);
				like.addI_Like_song("PVE9O3", s.getSong_id());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Test
	public void test02() {
		L_likeDAO like = new L_likeDAO();
		List<SongClass> ls = Crawler_data.grabble("海底", 0);
		UserDAO userDAO = new UserDAO();
		LoadUser lu = new LoadUser();
		User us = null;
		try {
		//	System.out.println(userDAO.login("PVE9O3","aaa"));
			us =  lu.loadUser(userDAO.login("PVE9O3","aaa"));
			//System.out.println(us.toString());
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		try {
			// like.addI_Like_song("PVE9O3", "1430583016");
			CancelDelete.cancelLike(ls.get(0), us);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
